package com.hooya.fa.eu.biz.scheduler;

import com.hooya.fa.eu.biz.service.Pl2cInvoicesService;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

@Slf4j
@Component
@RequiredArgsConstructor
public class Pl2cInvoicesHandler {

    private final Pl2cInvoicesService pl2cInvoicesService;

    /**
     * 欧盟审计订单获取发票数据并存入数据库
     */
    @XxlJob("pl2cInvoicesHandler")
//    @Scheduled(cron = "0 49 16 10 12 ?")
    public void invoicesHandler() {
        log.info(LocalDateTime.now() + "：开始进行欧盟审计订单获取发票数据");
        pl2cInvoicesService.saveInvoicesList();
        log.info(LocalDateTime.now() + "：结束欧盟审计订单获取发票数据");
        XxlJobHelper.handleSuccess("pl2cInvoicesHandler success");
    }
}
